/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package backend;

import buildings.Shipyard;
import java.util.ArrayList;

/**
 *
 * @author steely
 */
public class BuildShips {

    public static void calculate(int amount, Shipyard[] shipyards) {
	Shipyard shipyardToUse = shipyards[0];
	for (int i = 0; i < amount; i++) {
	    for (Shipyard shipyard : shipyards) {
		if (shipyardToUse == shipyard) {
		    shipyardToUse = shipyard;
		} else {
		    shipyardToUse = shipyardToUse.getTotalBuildTime() <= shipyard.getTotalBuildTime() ? shipyardToUse : shipyard;
		}
	    }
	    shipyardToUse.buildAnother();
	}

    }
}
